﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.ServiceModel;
using EnterpriseServices.DalEf;

namespace EnterpriseServices.Service
{
	/// <summary>
	/// 
	/// </summary>
	public class ApplicationService : IApplicationManager
	{

		#region IApplicationManager Members

		/// <summary>
		/// Adds a new application.
		/// </summary>
		/// <param name="application">The application.</param>
		[OperationBehavior(TransactionScopeRequired = true)]
		public void AddApplication(string ApplicationName)
		{
			using (ESDBEntities _ESDBEntities = new ESDBEntities())
			{
				DalEf.Application _newApp = new Application();

				_newApp.ApplicationName = ApplicationName;
				_newApp.LoweredApplicationName = ApplicationName.ToLower();

				_ESDBEntities.AddToApplications(_newApp);
				_ESDBEntities.SaveChanges();
			}

		}

		/// <summary>
		/// Removes all userNames and roles from the application and deletes the application.
		/// </summary>
		/// <param name="application">The application.</param>
		[OperationBehavior(TransactionScopeRequired = true)]
		public void DeleteApplication(string application)
		{
			throw new NotImplementedException();
		}

		/// <summary>
		/// Deletes all applications,and removes all userNames and roles from  all applications.
		/// </summary>
		[OperationBehavior(TransactionScopeRequired = true)]
		public void DeleteAllApplications()
		{
			throw new NotImplementedException();
		}

		/// <summary>
		/// Returns available applications.
		/// </summary>
		/// <returns></returns>
		public string[] GetApplications()
		{
			throw new NotImplementedException();
		}

#endregion IApplicationManager

	}
}
